feat(chat): VS Code-style file path context menu on change lists and tools#371
feat(chat): VS Code-style file path context menu on change lists and tools#371hkx1997 wants to merge 8 commits into
Conversation
|
Withdrawing to fix message-navigator context menu. Will reopen when fixed. |
|
@xintaofei 佬,增加了右键快捷功能 |
|
当前分支有冲突 |
Add a shared path context menu on the message navigator and reply artifacts cards: open in Codeg, add to chat as an @file badge, reveal in the system file manager, open with default app / VS Code / Cursor, and copy relative / absolute / file-name paths. Stop right-click propagation so the outer conversation panel menu no longer steals the event. Extend openPath to accept openWith for local desktop openers, and resolve native absolute paths for clipboard copy.
Follow-up to the changed-file context menu: claim right-clicks on tool headers so the conversation panel menu no longer steals them, show full absolute paths on Read/Edit title hover, and restore path links plus the same menu inside expanded Read/Write cards via shared path lookup.
Use-short-duration-for-copy-and-add-to-chat-success-toasts
264e15d to
ff8fb72
Compare
可以了,佬 |
|
先夸一下 👍 这个 PR 整体完成度很高,做了一轮比较深的评审后,几个点想先肯定:
下面把发现的问题一次性列全,方便一轮改完 🙏。就一个我建议合并前一定要修的阻塞项,其余都是小问题。 🔴 合并前建议修1. 非文件工具行(WebFetch / Glob / Grep …)被误挂「文件右键菜单 + 错误的绝对路径 tooltip」
以 WebFetch / Glob 为例(几乎每次调用都会命中):
因为是运行时 UI 启发式、单测没覆盖 建议改法(两处一起):
建议顺手补一条 🟠 建议一并处理(不阻塞,但体验上会踩坑)2. macOS「用…打开 → VS Code / Cursor」实测失效
(VS Code 的 建议:
3. 触屏 / 触控笔长按会同时弹出内外两个菜单
建议:把守卫放宽到覆盖长按向量: const claimRightPointer = useCallback((event: ReactPointerEvent) => {
if (event.button === 2 || event.pointerType !== "mouse") event.stopPropagation()
}, [])🟡 小问题 / nit(可跟进)
总体是个很不错的功能 ✨。把 #1(阻塞) 和 #2(macOS 打开) 修掉基本就可以合了;#3 建议同批修,其余归为跟进项即可。改动都不大——主要就是一个门控 + 一个平台分档 map。辛苦啦 🙌 |
- Only wrap Read/Edit/Write tool rows when isFilePathToolName matches - Tighten pathFromToolTitle; disable title shortPath fallback for open/tooltip - Multi-file edit returns no single path - macOS openWith uses Visual Studio Code / Cursor app names - Stop touch/pen long-press from opening the panel context menu - Catch openFilePreview rejections on tool-row open - Unit tests for WebFetch/Glob/multi-file false positives
Expand opener open-path and reveal scopes beyond $HOME so workspace files on Windows drives (E:/dev/...), macOS /Volumes, and Linux paths outside home can open with VS Code/Cursor. Normalize separators for glob matching. openWith stays platform-specific.
opener scope entries default to Application::Default which only matches openPath without `with`. Opening with "code"/"cursor"/app names requires explicit "app": true (or a specific app name) on each allow entry. Also keep broad path globs ($HOME, user dirs, /**, **) so workspaces outside the home directory work on Windows drives, macOS volumes, and Linux paths.
On Windows, open::with(path, "cursor") can ShellExecute-resolve to the Cursor install directory. Prefer %LOCALAPPDATA%\\Programs\\...\\Cursor.exe (and Code.exe for VS Code), then .cmd shims, then bare PATH names.
谢谢佬详细的指点,已完成提交 |
可以的佬,PR明天再看一下,早点休息 |

Summary
Shared VS Code-style file path context menu across chat surfaces, absolute-path tooltips for tool titles (especially Read), and short-lived toast feedback for menu actions.
Surfaces
FilePathLink)FilePathLink(e.g. diff headers)Menu actions
@filebadge via existingemitAttachFileToSession(same as file tree “Add to session”)Fixes included
[data-file-path-menu](no longer steals tool-row / path-link menus)Read AGENTS.md)FilePathLink(Edit / file lists were already fine)openPathaccepts optionalopenWithfor VS Code / CursortoNativeAbsoluteFilePathfor clipboard-friendly absolute pathsi18n & tests
Folder.chat.filePathMenuin all 10 localesTest plan
pnpm test(path helpers, link-safety, message nav)pnpm eslinton touched sources@fileinto composer